if  、 if else
if(条件成立){执行语句}
条件成立：转化为布尔值为true

<script type="text/javascript">
	if(1 < 2){
		document.write('a')
	}
	1 < 2 && document.write('a')

	if(1 > 0 && 1 > 2){
		console.log("不能打印")
	}

	
</script>

<script type="text/javascript">

	var score = parseInt(window.prompt("input"))

	if(score > 90 && score <= 100){
		console.log('1');
	}
	if(score > 80 && score <= 90){
		console.log('2');
	}
	if(score <= 80){
		console.log('3');
	}

</script>

<script type="text/javascript">
	var score = parseInt(window.prompt('input score'))

	if(score > 90 && score <= 100){
		console.log('1');
	}else if(score > 80 && score <= 90){
		console.log('2');
	}else{
		console.log('3')
	}
</script>


for循环

<script type="text/javascript">
	var i = 0;
	for(;i < 10; ){
		document.write('a');
		i ++;
	}

//打印1到10
	//for是关键字，括号里三个语句用两个分号隔开，大括号里面是循环体
	for(var i = 0; i < 10; i ++){
		document.write(i);
	}

	//1.var i = 0;
	//2.if(i < 10){document.write('a')}
	//3.i ++  --> i = 1
	//4.if(i < 10){document.write('a')}
	//5.i ++
	//6.if(i < 10){document.write('a')}

	执行1
	判断2 执行语句
	执行3

	var i = 0;
	for(;i < 10;){
		document.write('a');
		i ++
	}

//累和
	var count = 0;
	for(var i = 1; i < 10; i ++){
		count += i;
	}
</script>

打印100以内能被3整除和能被5整除
if(能被3整除或被5整除){打印}

<script type="text/javascript">
	for(var i = 1; i < 100; i ++){
		if(i % 3 == 0 || i % 5 == 0){
			document.write(' ');
		}
	}
</script>

打印0到100
<script type="text/javascript">
	for(var i = 0;i <100;i ++){
		document.write(i + ' ');
	}
</script>

<script type="text/javascript">
	var i = 0;
	for(;i < 100;){
		document.write(i + ' ');
		i ++;
	}
</script>

<script type="text/javascript">
	var a = 100;
	for( ; a --; ){
		document.write(a + ' ');
	}

</script>

//与for循环类似
<script type="text/javascript">
	var a = 100;
	while(a --){
		document.write(a + " ");
	}
</script>

//能被7整除的数
<script type="text/javascript">
	var i = 0;
	while(i < 100){
		if(i % 7 == 0){
			document.write(i + ' ');
		}
		i ++;
	} 

	never ending loop
	while(1){
		document.write('a')
	}
</script>

<script type="text/javascript">
	do{
		document.write('a')
	}while(0)

	var i = 0;
	do{
		document.write('a');
		i ++;
	}while(i < 10)
</script>